<template>
    <div class="adide">
       <div class="title">
          <!-- t-System -->
          <el-avatar :size="40" src="https://demos.creative-tim.com/vue-black-dashboard-pro/img/icon-vue.png"></el-avatar>
          <span style="margin-left:10px">Management</span>
       </div>
        <el-menu
        default-active="2"
        class="el-menu-vertical-demo"
        @select="handleSelect"
        background-color="#41b581"
        text-color="#fff"
        active-text-color="#1d253b">
        <el-menu-item index="home">
            <i class="el-icon el-icon-menu"></i>
            <span slot="title">首页</span>
        </el-menu-item>
        <el-menu-item index="student">
            <i class="el-icon el-icon-s-custom" ></i>
            <span slot="title">学生管理</span>
        </el-menu-item>
        <el-menu-item index="/course">
            <i class="el-icon el-icon-notebook-1" ></i>
            <span slot="title">成绩管理</span>
        </el-menu-item>
        <el-menu-item index="/leave">
            <i class="el-icon el-icon-document" ></i>
            <span slot="title">请假管理</span>
        </el-menu-item>
        <el-submenu index="1" >
        <template slot="title">
          <i class="el-icon el-icon-paperclip"></i>
          <span>外部链接</span>
        </template>
          <el-menu-item index="gitee">
            <i class="el-icon el-icon-s-promotion"></i>
            <span>Gitee仓库</span>
          </el-menu-item>
      </el-submenu>
    </el-menu>
    </div>
</template>

<script>
import logo from "@/assets/images/logo.svg";
  export default {
    data() {
        return {
            avatar : logo
        }
    },
    methods: {
      handleSelect(key, keyPath) {
        this.$router.push({
          path: key
        })
      },
      handleOpen(key, keyPath) {
        console.log(key, keyPath);
      },
      handleClose(key, keyPath) {
        console.log(key, keyPath);
      },
      setPath(){
        // let unlogin = localStorage.getItem("unlogin");
        // console.log(unlogin);
        // if(unlogin === "false")
        //   this.$router.push('/login')
        if (this.$route.path == '/' || this.$route.path == ''){
          this.$router.push('/home')
        }
        this.activeMenu = this.$route.path;
      }
    },
    mounted(){
      this.setPath()
    },
  }
</script>

<style lang="less">
.adide{
  .title{
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
    font-weight: 700;
    border-bottom: 5px solid #f6f6f6;
    .icon {
				width: 60px;
				height: 52px;
        border: 1px solid #fff;
		}
  }
  .el-icon{
    color: #fff;
    margin-right: 10px;
  }
}
</style>